
package com.wwy.monitor.model.enumeration;

import com.wwy.monitor.model.vo.EnumVO;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

/**
 * @author tianquan.ld
 * @version V1.0
 * <p>Description: 接收者类型</p>
 * @date 2019-10-29 16:49
 */
public enum ReceiverTypeEnum {

    PERSON(0, "个人"),
    GROUP(1, "群组"),
    ;

    /**
     * 状态码
     */
    private int value;
    /**
     * 状态描述
     */
    private String desc;

    ReceiverTypeEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 转换为enum的vo
     *
     * @return
     */
    public static List<EnumVO> toEnumList() {

        List<EnumVO> enumList = new ArrayList<>(ReceiverTypeEnum.values().length);
        Stream.of(ReceiverTypeEnum.values()).forEach((item) -> {
            EnumVO enumVo = new EnumVO();
            enumVo.setValue(item.getValue());
            enumVo.setDesc(item.getDesc());
            enumList.add(enumVo);
        });

        return enumList;
    }
}